home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5391 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.eznet.net!usenet
  2. From: Joe Mihalich <mihalich@eznet.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Comparing Struct elements
  5. Date: Sat, 03 Feb 1996 16:48:30 -0500
  6. Organization: E-Znet Inc. Rochester N.Y. 14623 (716)-262-2485
  7. Message-ID: <3113D82E.7CB7@eznet.net>
  8. References: <4eo1va$s6k@camelot.ccs.neu.edu>
  9. NNTP-Posting-Host: dialin-06.eznet.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (Win95; I)
  14.  
  15. saurabh bhardwaj wrote:
  16. > struct ClassRec {
  17. >      char Grade[3];
  18. >      int   QH;
  19. >      char Name[10];
  20. >      };
  21. > I can't seem to compare the elements of the Grade[3] with "A" or "A-" or "B+"
  22. > The function invariable returns 0.  I've also tried using the -> operator.  It
  23. > doesn't work either!!!   Anyone know why???  I'll appreciate any help.
  24.  
  25.     Uhh, am I missing something?  If the array is declared as "char Grade[3];" then
  26.     the array goes from 0 to 2.  3 is an invalid index!  If you need an extra place
  27.     holder than declare the array as "char Grade[4];"
  28.  
  29.     Hope this helps.
  30.  
  31.  
  32. -- 
  33.     Joe Mihalich
  34.     Email: mihalich@eznet.net
  35.     Voice: 716-482-0089
  36.